package com.wanshu.service.impl;

import com.wanshu.dao.ShopDao;
import com.wanshu.entity.Shop;
import com.wanshu.service.ShopService;

import javax.annotation.Resource;
import java.util.List;

public class ShopServiceImpl implements ShopService {


    @Resource
    private ShopDao shopDao;

    public void setShopDao(ShopDao shopDao) {
        this.shopDao = shopDao;
    }

    public Shop findById(Integer id){
        return shopDao.findById(id);
    }

    public String delete(Integer id){
        Integer delete = shopDao.delete(id);
        if(delete > 0){
            return "删除成功!";
        }else{
            return "删除失败!";
        }
    }

    public String insert(Shop shop){
        Integer insert = shopDao.insert(shop);
        if(insert > 0){
            return "增加店铺成功!";
        }
        return "新增失败!";
    }

    public List<Shop> findAll(){
        return shopDao.findAll();
    }
}
